package com.charlee.service.impl;

import com.charlee.entity.User;
import com.charlee.mapper.UserMapper;
import com.charlee.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by charlee
 * on 17-6-10
 * version v1.0.0
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {

    private final UserMapper userMapper;

    @Autowired
    public UserServiceImpl(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @Override
    @Transactional(readOnly = true)
    public User findUser(String username, String password) {
        return userMapper.findUserByUsernameAndPassword(username, password);
    }

    @Override
    public List<User> findAllUser() {
        return userMapper.findAllUser();
    }
}
